﻿<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="../images/favicon.ico">
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>

<!-- 文件上传需要的样式 -->

<link rel="stylesheet" type="text/css"
	href="${path }/resource/plugin/kindeditor/themes/default/default.css" />
<link rel="stylesheet" type="text/css"
	href="${path }/resource/plugin/kindeditor/plugins/code/prettify.css" />
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/kindeditor.js"></script>
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/plugins/code/prettify.js"></script>
<style>
	ul,li{list-style:none;padding：0;margin:0;}
	h3,label{
		font-size:18px;
		font-family: "微软雅黑";
	}
	.task{
		font-family: "微软雅黑";
	}
	.task ul li{
    	margin-bottom:5px;
    	padding-left: 15px;
    	background: url("http://www.yangqq.com/skin/2014/images/li.jpg") no-repeat left 6px;	
	}
	.article-con{margin-top:-12px;}
</style>
<title></title>
</head>
<div class="ibox-content">
	<form class="form-horizontal" id="dataform"
		onsubmit="javascripr:return false;">
		<input type="hidden" name="tokenUrl" value="${tokenUrl}">	 
		<input type="hidden" name="token" value="${token}">
		<div class="form-group task">
			<h3 class="col-sm-2 text-right">任务说明</h3>
           	<ul class="col-sm-12 col-sm-push-2">
           		<li>使用框架设计一个小的项目进行练习，具体命题和导师确认。</li>
           		<li>作品完成后需要提交项目总结：</li>
           		<li>包括：项目名称、项目周期、项目功能说明、项目截图、框架使用心得、自我总结。</li>
           		<li>图片上传后导师确认完成后才能做下一个任务</li>
           </ul> 
		</div>
		<c:if test="${obj ne null }">
			<div class="form-group">
				<label class="col-sm-2 control-label article-con">项目总结</label>
				<div class="col-sm-8" >
					<p readonly="readonly">
						${obj.projectSum}
					</p>
					<button class="btn btn-primary center-block" onclick="finishTask(${obj.newId})" >确认完成任务</button>
				</div>
				
			</div>
		</c:if>
		<c:if test="${obj1 ne null }">
			<div class="form-group">
				<label class="col-sm-2 control-label article-con">项目总结</label>
				<div class="col-sm-8">
					<textarea name="projectSum" id="artcontent">
						${obj1.projectSum}
					</textarea>
				</div>
				<div class="Validform_checktip"></div>
			</div>
			<div class="form-group ">
				<div class="col-sm-12 text-center">
					<a href="javascript:;" onclick="myForm.submit()"
						class="btn btn-success radius">保存</a>&nbsp;&nbsp;&nbsp;&nbsp; 
					<button type="button" class="btn btn-danger radius" onclick="MTools.closeForm()">取消</button>
				</div>
			</div>
		</c:if>
	</form>


</div>

</body>
	<script type="text/javascript">
		var editor = null;
		var myForm=MForm.initForm({
			invokeUrl:"${path}/admin/taskExecution/workPractice",
			beforeSubmit:function(){
				editor.sync();
			},
			afterSubmit:function(){
				layer.close();
				parent.location.reload();
			},
		});
		
		$(function() {		
			MUI.createEdit("projectSum", '100%', '400px', 'editor');
			initFunctionList();
		});
		
		/**
		*导师阅读项目总结  点击完成任务 
		*/
		function finishTask(newId){
			layer.confirm("确认结束任务？",function(){
		        $.AjaxProxy().invoke("${path}/admin/taskExecution/endWorkPracticeTask?newId="+newId,function(loj){
		        	if(loj.getValue("status") == 'ok'){
						layer.alert(loj.getValue("info"), {
							icon : 1
						}, function(inindex) {
							// 关闭提示层
							layer.close(inindex);
							layer.close();
							parent.location.reload();
						});
					}else{
						layer.alert(loj.getValue("info"), {
							icon : 5
						}, function(inindex) {
							// 关闭提示层
							layer.close(inindex);
						});
					}
		        });
			});
		}
	</script>
</html>